
import {ConfigDataMatcher} from "./ConfigDataMatcher";
import {EntityIndex, PrimaryEntityIndex} from "../../3rd/entitas/EntiasIndex";
import {ConfigDataCompIds} from "./ConfigDataComponentsIds";
import {ConfigDataContextInterface} from "./ConfigDataContext";
import {ConfigDataEntity} from "./ConfigDataEntity";

ConfigDataContextInterface.prototype.initGenerateEntityIndexes = function (){
    let group
    group = this.getGroup(ConfigDataMatcher.Platform)
    this._PlatformIndex =  new EntityIndex(ConfigDataCompIds.Platform, group, 'value')
    group = this.getGroup(ConfigDataMatcher.SheetName)
    this._SheetNameIndex =  new EntityIndex(ConfigDataCompIds.SheetName, group, 'value')
}

ConfigDataContextInterface.prototype.GetEntitiesByPlatformIndex= function (platform){
    return this._PlatformIndex.getEntities(platform)
}
ConfigDataContextInterface.prototype.GetEntitiesBySheetNameIndex= function (sheetName){
    return this._SheetNameIndex.getEntities(sheetName)
}

interface IConfigDataContext {
    initGenerateEntityIndexes()
    GetEntitiesByPlatformIndex(platform) : Array<ConfigDataEntity>
    _PlatformIndex : EntityIndex
    GetEntitiesBySheetNameIndex(sheetName) : Array<ConfigDataEntity>
    _SheetNameIndex : EntityIndex

}